package com.frame.exception

import org.slf4j.Logger
import org.slf4j.LoggerFactory

import javax.ws.rs.NotFoundException
import javax.ws.rs.core.Response
import javax.ws.rs.ext.ExceptionMapper
import javax.ws.rs.ext.Provider

/**
 * Created by three on 14-8-4.
 */
@Provider
class NotFoundExceptionMapper implements ExceptionMapper<NotFoundException> {

    private Logger log = LoggerFactory.getLogger(NotFoundExceptionMapper.class);

    @Override
    Response toResponse(NotFoundException exception) {
        log.info("资源没有找到", exception)
        return Response.status(Response.Status.NOT_FOUND).entity("资源没有找到!"+exception.getMessage()).
                type("text/plain").build();

    }
}
